﻿using System.Collections;
using System.IO;
using System.Web;
using System.Web.Hosting;

namespace JoelAbrahamsson.TestUtilities
{
    public class HttpContextSetup
    {
        public static void InitCurrentHttpContext()
        {

            TextWriter tw = new StringWriter();

            HttpWorkerRequest wr = new SimpleWorkerRequest(

              "/",

              "C:\\",

              "default.aspx", "", tw);

            HttpContext.Current = new HttpContext(wr);

        }



        public static void ClearCurrentContextCache()
        {

            if (HttpContext.Current != null)
            {

                foreach (DictionaryEntry cache in HttpContext.Current.Cache)

                    HttpContext.Current.Cache.Remove(cache.Key.ToString());



                return;

            }

        }
    }
}
